﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;
using JKF.Substructure;//请先添加引用

namespace JKF.DataModule
{
    public static class DataPage
    {
         public static  DataSet GetPageInfo(string tbname, string fieldKey, int pageCurrent, int pageSize, string fieldShow, string fieldOrder, string strWhere, ref int pageCount, ref int rowCount)
         {
             Database db = DB.HR;
             DbCommand dbCommand = db.GetStoredProcCommand("p_pageView");
             db.AddInParameter(dbCommand, "@tbname", DbType.String, tbname);
             db.AddInParameter(dbCommand, "@FieldKey", DbType.String, fieldKey);
             db.AddInParameter(dbCommand, "@PageCurrent", DbType.Int32, pageCurrent);
             db.AddInParameter(dbCommand, "@PageSize", DbType.Int32, pageSize);
             db.AddInParameter(dbCommand, "@FieldShow", DbType.String, fieldShow);
             db.AddInParameter(dbCommand, "@FieldOrder", DbType.String, fieldOrder);
             db.AddInParameter(dbCommand, "@Where", DbType.String,strWhere);
             db.AddOutParameter(dbCommand, "@PageCount", DbType.Int16, pageCount);
             db.AddOutParameter(dbCommand, "@RecordCount", DbType.Int16, rowCount);
             DataSet ds = db.ExecuteDataSet(dbCommand);
             pageCount = int.Parse(dbCommand.Parameters["@PageCount"].Value.ToString());
             rowCount = int.Parse(dbCommand.Parameters["@RecordCount"].Value.ToString());
             return ds;
         }
    }
}
